package club.hicode.daydayup.juc;

import org.junit.Test;

import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * 可重入锁的理解
 *
 * @author Liu Chunfu
 * @date 2018-06-11 下午2:46
 **/
public class ReentrantLock {

    public class Widget {
        public synchronized void doSomething() {
            System.out.println("super do ...");
        }
    }

    public class LoggingWidget extends Widget {
        public synchronized void doSomething() {
            System.out.println(toString() + ": calling doSomething");
            super.doSomething();
        }
    }

    @Test
    public void test1() {
        LoggingWidget widget = new LoggingWidget();
        widget.doSomething();
    }

    @Test
    public void testQueue() {
        ArrayBlockingQueue queue = new ArrayBlockingQueue(10);
    }
}
